package com.acwing.partition18;

import java.io.*;
import java.util.Arrays;

/**
 * @author `RKC`
 * @date 2022/4/7 16:29
 */
public class AC1788牛为什么过马路 {

    private static int[] c = new int[11];

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        int n = Integer.parseInt(reader.readLine()), ans = 0;
        Arrays.fill(c, -1);
        while (n-- > 0) {
            String[] ss = reader.readLine().split(" ");
            int a = Integer.parseInt(ss[0]), b = Integer.parseInt(ss[1]);
            if (c[a] != -1 && c[a] != b) ans++;
            c[a] = b;
        }
        writer.write(ans + "\n");
        writer.flush();
    }
}
